// use std::sync::Arc;

// use thrussh::*;
// use thrussh::server::{Auth, Session};
// use thrussh_keys::*;
// use futures::Future;
// use std::io::Read;
// // use futures::
// // use futures::finished;

// struct Client {
//  key: Arc<thrussh_keys::key::KeyPair>
// }

// impl client::Handler for Client {
//    type Error = ();
//    type FutureBool = futures::Finished<(Self, bool), Self::Error>;
//    type FutureUnit = futures::Finished<Self, Self::Error>;
//    type FutureSign = futures::Finished<(Self, thrussh::CryptoVec), Self::Error>;
//    type SessionUnit = futures::Finished<(Self, client::Session), Self::Error>;
//    fn check_server_key(self, server_public_key: &thrussh_keys::key::PublicKey) -> Self::FutureBool {
//        println!("check_server_key: {:?}", server_public_key);
//        futures::finished((self, true))
//    }
//    fn channel_open_confirmation(self, channel: ChannelId, session: client::Session) -> Self::SessionUnit {
//        println!("channel_open_confirmation: {:?}", channel);
//        futures::finished((self, session))
//    }
//    fn data(self, channel: ChannelId, ext: Option<u32>, data: &[u8], session: client::Session) -> Self::SessionUnit {
//        println!("data on channel {:?} {:?}: {:?}", ext, channel, std::str::from_utf8(data));
//        futures::finished((self, session))
//    }
// }

// impl Client {

// fn run(self, config: Arc<client::Config>, _: &str) {
//     let key = self.key.clone();
//     tokio::runtime::run(

//       client::connect_future(
//         "127.0.0.1:2222", config, None, self,
//         |connection| {
//           connection.authenticate_key("pe", key)
//             .and_then(|session| {
//               session.channel_open_session().and_then(|(session, channelid)| {
//                 session.data(channelid, None, "Hello, world!").and_then(|(mut session, _)| {
//                   session.disconnect(Disconnect::ByApplication, "Ciao", "");
//                   session
//                 })
//               })
//         })
//       }).unwrap().map_err(|_| ())
//     )
//  }
// }